from flask import jsonify
from . import show
from ..models import advertisement

# √
# 请求广告页
@show.route('/rotationCharts', methods=['GET'])
def getRoattionCharts():
    print("In adver")
    advertise = advertisement.query.filter_by(is_used=True).all()
    advertise = [a.to_json() for a in advertise]

    response = jsonify(message="Get advertise", advertise=advertise)
    response.status_code = 200
    return response
